package uk.ac.aber.Blockmation.Tests;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;

import uk.ac.aber.Blockmation.ScottyIntoImages;

public class ScottyIntoImagesTest {

    /**
     * @param args
     */
    public static void main(String[] args) {

        ArrayList<BufferedImage> images = new ArrayList<BufferedImage>();

        ScottyIntoImages sii = new ScottyIntoImages(); 
        images = sii.decodeAsBufferedImages(
                        "src/uk/ac/aber/Blockmation/Tests/scotty.txt");

        try {
            
            for (int i=0; i < images.size(); i++)
            {
                    BufferedImage image = images.get(i); 

    /*	resizing:
    *     		
    * 					final double SCALE = 30;
                    int w = (int) (SCALE * image.getWidth());
                    int h = (int) (SCALE * image.getHeight());
                    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                    GraphicsDevice gd = ge.getDefaultScreenDevice();
                    GraphicsConfiguration gc = gd.getDefaultConfiguration();
                            BufferedImage resize = Example.getScaledInstance(image, w, h, gc);
                            ImageIO.write(resize, "bmp", new File("src/"+(i+1) +".bmp"));
    */

                    ImageIO.write(images.get(i), "bmp", 
                                    new File("src/uk/ac/aber/Blockmation/Tests/"+(i+1) +"x.bmp"));
            }

        } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }

    }
}
